home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 14935 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.0 KB

  1. Path: news.sni.de!news
  2. From: Josef Moellers <mollers.pad@sni.de>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: char* still alive after free ???
  5. Date: 16 Apr 1996 06:56:36 GMT
  6. Organization: Siemens Nixdorf Informationssysteme AG, Paderborn, Germany
  7. Message-ID: <4kvgb4$3vt@nervous.pdb.sni.de>
  8. References: <317269EA.11BB93C2@studbox.uni-stuttgart.de> <829591931snz@genesis.demon.co.uk>
  9. NNTP-Posting-Host: uranium.pdb.sni.de
  10. X-Newsreader: NN version 6.5.0 #2
  11.  
  12. In <829591931snz@genesis.demon.co.uk> Lawrence Kirby <fred@genesis.demon.co.uk> writes:
  13.  
  14. >>free(text); text=NULL; and finally a
  15.  
  16. >The text = NULL; is redundant.
  17.  
  18. It's NOT redundant! It would be if "free(text)" would set "text" to
  19. NULL, but since arguments are passed by value in C, this is unlikely.
  20.  
  21. If you'd chased as many bugs that use free'd memory as I did, you'd be
  22. gratefull for every "ptr = NULL" people write. These bugs have
  23. disastrous results and are extremely hard to trace!
  24.  
  25. Happy clearing,
  26.  
  27. Josef
  28. --
  29. Josef Moellers        work: mollers.pad@sni.de
  30.             home: josef@firefox.pb.owl.de
  31.